package com.coolweather.android;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import com.coolweather.android.db.City;

import org.litepal.tablemanager.Connector;

public class MainActivity2 extends AppCompatActivity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);

        Button createDataBase = (Button) findViewById(R.id.createDataBase);
        createDataBase.setOnClickListener((view -> {
            Log.d("触发","info");
            Connector.getDatabase();

        }));
        /*createDataBase.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d("触发","info");
                Connector.getDatabase();
            }
        });*/
        Button createData = (Button) findViewById(R.id.btn2);
        createData.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                City city = new City();
                city.setId(001);
                city.setCityCode(20);
                city.setCityName("绵阳");
                city.setProvinceId(88);
                city.save();
            }
        });
    }
}